##### R Code for 'Obtaining References' ##### # https://compadre-db.org/Education/article/obtaining-references # Compiled on 28 May 2021 ##### Preliminaries ##### # Use the command following commands if you haven't already # downloaded the packages: # install.packages("Rcompadre") # Alternatively, see https://jonesor.github.io/Rcompadre/index.html for instructions to download the Rcompadre package # install.packages("rcrossref") # load packages library(Rcompadre) library(rcrossref) ##### Load COMPADRE and COMADRE databases ##### # Download and load either the COMPADRE or COMADRE database from the website # In this example, we use the COMADRE database # COMPADRE: https://compadre-db.org/Data/Compadre # COMADRE: https://compadre-db.org/Data/Comadre # load dataset comadre <- load("COMPADRE_v.6.21.1.0.RData") ## Then convert to an S4 CompadreDB object to work with Rcompadre package comadre <- as_cdb(comadre) # OR, you may also download the COMPADRE or COMADRE objects using the Rcompadre package if you have Rcompadre installed: # COMPADRE compadre <- cdb_fetch("compadre") # COMADRE comadre <- cdb_fetch("comadre") ##### Obtaining references ##### ## Examine the number of matrices for species in the Canidae family (wolves, foxes, and similar animals) in the COMADRE database. ## Then create a subset of the database containing only data for animals in Canidae comadre$MatrixID[which(comadre$Family == "Canidae")] comadre_subset <- comadre[which(comadre$Family == "Canidae")] ## Examine some of the fields in COMPADRE and COMADRE metadata for finding references associated with matrix population models comadre_subset$Authors comadre_subset$YearPublication comadre_subset$DOI_ISBN ## number of unique references length(unique(comadre_subset$DOI_ISBN)) ## Use the rcrossref package to create a references list based on our data subset rcrossref::cr_cn(unique(comadre_subset$DOI_ISBN), format = "text", style = "apa" )